core: Add runtime ostree_check_version()
authorColin Walters <walters@verbum.org>
Mon, 13 Mar 2017 13:45:51 +0000 (09:45 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 13 Mar 2017 14:29:02 +0000 (14:29 +0000)
[Previously](https://github.com/ostreedev/ostree/pull/728) we added compile-time
checking for versions, but there are use cases for runtime checking as well,
because in a number of API calls we use `GVariant` as an API extension
mechanism.

Closes: #735
Approved by: jlebon

apidoc/ostree-sections.txt
src/libostree/libostree.sym
src/libostree/ostree-core.c
src/libostree/ostree-core.h

index 787664b31e3556c7da965da6177f8856f88f66a4..cba6ec467e78323cc5db97006932f002b4729dcd 100644 (file)
@@ -133,6 +133,7 @@ ostree_validate_structureof_dirtree
 ostree_validate_structureof_dirmeta
 ostree_commit_get_parent
 ostree_commit_get_timestamp
+ostree_check_version
 </SECTION>
 
 <SECTION>
index b7cfc454587dae41174de92cf4c533a9ad6d9284..9067a26c3d4f654d98cce7eff4743e6fe54b3dd5 100644 (file)
@@ -386,12 +386,10 @@ global:
  *                         NOTE NOTE NOTE
  */
 
-/* Stub section for new version, uncomment when the first symbol is added
-LIBOSTREE_2017.$NEWVERSION {
+LIBOSTREE_2017.4 {
 global:
-       someostree_symbol_deleteme;
-} LIBOSTREE_2017.2;
-*/
+  ostree_check_version;
+} LIBOSTREE_2017.3;
 
 /* Stub section for the stable release *after* this development one; don't
  * edit this other than to update the last number.  This is just a copy/paste
index cf238b410ba481848dfd0d6c87b938e034fea00c..db03c034d1510916d9711a53818ab700a009bfec 100644 (file)
@@ -2153,3 +2153,16 @@ _ostree_get_default_sysroot_path (void)
 
   return default_sysroot_path;
 }
+
+/**
+ * ostree_check_version:
+ * @required_year: Major/year required
+ * @required_release: Release version required
+ *
+ * Returns: %TRUE if current libostree has at least the requested version, %FALSE otherwise
+ */
+gboolean
+ostree_check_version (guint required_year, guint required_release)
+{
+  return OSTREE_CHECK_VERSION(required_year, required_release);
+}
index bd3d5f2ccea731ae0fdf4ea3b8f1a6526b2fe1e0..bcade9db8405395fd14af66b36b8185d9aa10932 100644 (file)
@@ -399,4 +399,7 @@ gchar *  ostree_commit_get_parent            (GVariant  *commit_variant);
 _OSTREE_PUBLIC
 guint64  ostree_commit_get_timestamp         (GVariant  *commit_variant);
 
+_OSTREE_PUBLIC
+gboolean ostree_check_version (guint required_year, guint required_release);
+
 G_END_DECLS